package com.byedu.jupiter.service.impl.course;

import com.byedu.jupiter.dao.course.CourseDAO;
import com.byedu.jupiter.domain.course.CourseDO;
import com.byedu.jupiter.service.course.CourseService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by jason on 2017/6/13.
 */
public class CourseServiceImpl implements CourseService {

    @Autowired
    private CourseDAO courseDAO;

    @Override
    public List<CourseVO> list(CourseVO courseVO) {
        CourseDO courseDO = new CourseDO(courseVO);
        return courseDAO.listCourse(courseDO);
    }

    @Override
    public void saveOrUpdate(CourseVO courseVO) {
        CourseDO courseDO = new CourseDO(courseVO);
        if (courseVO.getId() != null) {
            courseDAO.updateCourse(courseDO);
        } else {
            courseDAO.insertCourse(courseDO);
        }
    }
}
